<!doctype html>
<html>
<head>
    <title>家宴</title>
    <meta charset="utf-8" />
    <meta content="application/xhtml+xml;charset=UTF-8" http-equiv="Content-Type" />
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" name="viewport">
    <meta content="no-cache,must-revalidate" http-equiv="Cache-Control" />
    <meta content="no-cache" http-equiv="pragma" />
    <meta content="0" http-equiv="expires" />
    <meta content="telephone=no, address=no" name="format-detection" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <link type="text/css" rel="stylesheet" href="{RESNEW}css/style.css?<?=time()?>" />
    <link rel="stylesheet" type="text/css" href="{RES}css/wei_canyin.css?<?=time()?>" media="all" />
    <link rel="stylesheet" type="text/css" href="{RES}css/wei_dialog.css?<?=time()?>" media="all" />
    <script src="{RESNEW}js/jquery.js"></script>
    <script type="text/javascript" src="{RESNEW}js/TouchSlide.1.1.js"></script>
    <script type="text/javascript" src="{RES}js/wei_webapp_v2_common.js"></script>
    <script type="text/javascript">
    </script>
<style>
*{padding:0px; margin:0px;}
li{list-style-type:none;}

.address{padding:10px 0 5px;text-align:center;}
.address_findout{border:1px solid #999;display:inline-block;border-radius:5px;width:85%;position:relative;}
.address_find{width:88%;padding:8px 15px;background:#fafafa;}
.address_findimg1{width:35px;position:absolute;top:-1px;right:5px;}
.address_head{padding:12px 20px 12px 10px;overflow:hidden;background:#EBEBEB;}
.address_headp1{float:left;color:#333;}
.address_headp2{float:right;color:#30ADB4;padding-right:8px;}
.address_check{width:16px;height:16px;padding:0 5px 0 0;background:#EBEBEB;border:0;display: block;clear: left;margin:0;}
.address_checkout{float:right;border-radius:3px;display:inline-block;margin-top:4px;}
.address_list{padding:12px 20px 12px 15px;background:#33BEC6;overflow:hidden;}
.address_list1{padding:12px 20px 12px 15px;background:#33BEC6;overflow:hidden;}
.address_listcheckout{float:right;border-radius:3px;display:inline-block;margin-top:4px;border:1px solid #FFF;float:left;}
.address_listcheck{width:16px;height:16px;padding:0 5px 0 0;background:#EBEBEB;border:none;display: block;clear: left;margin:0;}
.address_listp1{color:#FFF;float:left;font-size:18px;padding-top:2px;}
.address_listimg1{width:25px;float:right;}
.address_listimg11{width:25px;float:right;display:none;}
.address_listimg2{width:25px;float:right;}
.address_listimg22{width:25px;float:right;display:none;}
.address_phone{}
.address_bottom{background:#DFDFDF;padding:10px 0;text-align:center;position:fixed;bottom:0;width:100%;}
.address_bot{width:110px;overflow:hidden;display:inline-block;}
.address_bottomimg{width:30px;float:left;}
.address_bottomp{float:right;color:#30ADB4;font-size:18px;padding-top:5px;}
.address_phonelist{}
.address_phonelistimg{width: 100%;}
.address_phonelistp{float:left;color:#666;font-size:1rem;padding:5px 0 0 10px;}
.address_phonelistcheck{float:right;width:16px;height:16px;border:none;display: inline-block;margin:0;margin-top:6px;}
.address_matephone{background:#FAFAFA;display:none;}

.caili{width: 48%;float: left;}
.form_radio{display:none}
.telBox{margin-bottom:2px;}
.form_lable{ background:url(images/check2.png) no-repeat;background-size:20px 20px;width:20px;height:20px;display:inline-block;float:right;margin-top:3px;margin-right:5px;}
.form_lable1{background:url(images/baicheck.png) no-repeat;background-size:20px 20px;width:20px;height:20px;display:inline-block;float:left;margin-top:3px;margin-right:5px;}
.form_lable_checked{background:url(images/checked2.png) no-repeat;background-size:20px 20px;width:20px;height:20px;display:inline-block;float:right;margin-top:3px;margin-right:5px;}
.form_lable_checked1{background:url(images/baichecked.png) no-repeat;background-size:20px 20px;width:20px;height:20px;display:inline-block;float:left;margin-top:3px;margin-right:5px;}
.normailcolor{color: #fff;font-size: 0.7rem;}
.normailcolor2{color: #606060;font-size: 0.7rem;}
.currencolor{color: #FF8000;font-weight: bold;font-size: 0.7rem;}
#totalprice{padding-right: 5px;}
.bbox{position: absolute;right: 0;text-align: center;border: 0;margin: 0;bottom: 7px; width: 100px;}
.bbox input {vertical-align: middle;}
.bbox input[type=button] {
	padding: 0;
	width: 22px;
	height: 22px;
	margin: 0 2px;
	border: none;
	text-indent: -25em;
}
.bbox input[type=button].btn-reduce {
	background: url("images/typebtn1a.png") no-repeat;
	background-size: 22px 22px;
}
.bbox input[type=button].btn-plus {
	background: url("images/typebtn2a.png") no-repeat;
	background-size: 22px 22px;
}
.bbox input[type=text] {
	width: 20px;
	height: 23px;
	text-align: center;
	background: #000;
	background-size: 20px 23px;
	border: none;
	color: #c9a063;
}
.right_part{width:150px;height:100%;position:absolute;right:0;top:0;display:none;background:#666;overflow:auto; text-align:center;margin-top: 8.1rem;}
.right_part p{text-align:center;color:#FFF;padding:4px 0;display:inline-block;width:120px;font-size:16px;}
.right_part a{color:#c9a063;}
.paiming{position:relative;overflow:hidden;}
.noshow{display: none;}
</style>    
</head>
<body style='background-color: #000;' onload="window_onload();">

{template common_search2}
<section style="top: 2.4rem; clear: both; display: block;width: 100%;padding-left: 2px;position: fixed; z-index: 999;" class="cheflist"  id="genchooslist1">
<div style="height: 0.2rem;background: #000;width: 100%;"></div>
<ul id="tao1" style="width: 100%;padding-left: 0px;">
<li style="width: 22%;color: white;height: 2rem;line-height: 2rem;text-align: center;padding-top: 3px;padding-left: 10px;font-size: 0.7rem;background:url(/images/tuijian2.png) no-repeat #222322 50% 50%;">推荐套餐</li>
<li style="height: 2rem;line-height: 2rem; width: 25%;text-align: center;padding-top: 3px;position: relative;font-size: 1rem;" class="normailcolor2 <? if($pakageid==$genius_list[0][id]){ echo "currencolor";}?>" onclick="javascript:getgenius('{$genius_list[0][id]}',$(this))"><em style="font-size: 0.4rem;">￥</em><?=$genius_list[0]["totalprice"]?></li>
<li style="height: 2rem;line-height: 2rem;width: 25%;text-align: center;padding-top: 3px;position: relative;font-size: 1rem;" class="normailcolor2 <? if($pakageid==$genius_list[1][id]){ echo "currencolor";}?>" onclick="javascript:getgenius('{$genius_list[1][id]}',$(this))"><span style="background: #000;height: 0.8rem;width: 1px;left: 0; top:0.8rem;position: absolute;"></span><em style="font-size: 0.4rem;">￥</em><?=$genius_list[1]["totalprice"]?></li>
<li style="height: 2rem;line-height: 2rem;width: 25%;text-align: center;padding-top: 3px;position: relative;font-size: 1rem;" class="normailcolor2 <? if($pakageid==$genius_list[2][id]){ echo "currencolor";}?>" onclick="javascript:getgenius('{$genius_list[2][id]}',$(this))"><span style="background: #000;height: 0.8rem;width: 1px;left: 0; top:0.8rem;position: absolute;"></span><em style="font-size: 0.4rem;">￥</em><?=$genius_list[2]["totalprice"]?></li>
</ul>
</section>
<section style=" clear: both; display: block;width: 100%;padding-left: 0px;top: 5.2rem;position: fixed; z-index: 999;" class="cheflist" id="genchooslist2">
<div style="height: 0.2rem;background: #000;width: 100%;"></div>
<ul id="tao2" style="width: 100%;padding-left: 0px; ">
<li style="width: 22%;height: 2rem;line-height: 2rem;text-align: center;padding-top: 2px;margin-top:0px;padding-left: 10px;font-size: 0.7rem;background:url(/images/diy2.png) no-repeat #222322 50% 50%;border-radius: 2px;" class="normailcolor <? if(empty($pakageid)){ echo "currencolor";}?>" onclick="javascript:getgenius('0',$(this))">自选套餐</li>
<li style="height: 2rem; line-height: 2rem;width: 75%;text-align: right;padding-top: 2px;color:#ffffff;margin-top:0px;background-color: #222322;"><em style="font-size: 0.4rem;">总价：￥</em><span id="totalprice" style="font-size: 1rem;">0</span></li>
</ul>
</section>

<div class="paiming">
<section style="clear: both; display: block;width: 100%;margin-top: 8.1rem; " id="c_lists">
<div style="position: fixed;right: 0;" id="remove"><img src="/images/leftside2.png" width="20" /></div>
<div style="text-align: center; clear: both;" class="mainnav address_phone">
<ul>
{loop $goods_list $row}
 <li style="padding-bottom: 10px;position: relative;" class="goods{$row[pcate]}">
 <a href="javascript:;" class="dataIn" onclick="showgoodsDetail('{$row['id']}');event.stopPropagation();">
 <img src="{$row[thumb]}" class="address_phonelistimg" style="width: 144px;height:90px ;" /></a><div class="navtitle" style="color: #c9a063;bottom: 30px;height: 30px; font-size: 0.8rem;width: 148px;text-align: left;"><span style="float: right;"><em style="font-size: 0.4rem;">￥</em><?=number_format($row[productprice],0)?> <em style="font-size: 0.4rem;">/份</em></span> {$row[title]}  </div>
 
  <p style="float: left;" class="address_phonelist">
    <input class="form_radio" type="checkbox" name="teacherid[]" value="{$row[id]}" id="teacher{$row[id]}" isgen="0" />
    <label for="teacher{$row[id]}" id="dishs{$row[id]}" class="form_lable" onclick="javascript:mcheck($(this),'{$row[id]}',{$row[productprice]});"></label>
  </p> 

<section class="bbox" dishname="{$row[title]}" onclick="changeCount(this, event, '{$row[id]}');">
                        <input class="btn-reduce" type="button" value="-" />
                        <input class="numBox" id="numBox{$row[id]}" name="numBox" type="text" value="0" price="{$row[productprice]}" readonly="readonly">
                        <input type="button" class="btn-plus" value="+" />
</section>
                        
</li>
{/loop}             
</ul>
</div>
</section>
</div>
<div class="right_part"> 
    <div style="text-align:center;">
    <p><a href="javascript:showcates('0')">全部</a></p><img src="images/xiahuaxian.png" />
    {loop $classselect $row}
      <p><a href="javascript:showcates('{$row[id]}')">{$row[name]}</a></p><img src="images/xiahuaxian.png" />
    {/loop}
    </div>
</div>        
<div id="footer_menu" class="footer footer_menu">
            <ul class="clear">
				 {if ($_GPC['do']!='wlmember' && $_GPC['do']!='wlorder'&& $_GPC['do']!='wlmylike' && $_GPC['do']!='wlhome'  && $_GPC['do']!='wlgenius' )}
                <li><a href="{php echo  $this->createMobileUrl('wlmain')}" class="onactive" ><span class="icons icons_2"></span><label>首页</label></a></li>
				{else}
				<li><a  href="{php echo  $this->createMobileUrl('wlmain')}" ><span class="icons icons_2"></span><label>首页</label></a></li>
				{/if}
                {if $_GPC['do']=='wlmember'||$_GPC['do']=='wlorder'}
				<li><a href="{php echo  $this->createMobileUrl('wlmember',array('status'=>1))}" class="onactive" ><span class="icons icons_3"></span><label>订单</label></a></li>
				{else}
				<li><a href="{php echo  $this->createMobileUrl('wlmember',array('status'=>1))}" ><span class="icons icons_3"></span><label>订单</label></a></li>
				{/if}
                
                {if $_GPC['do']=='wlmylike'}				
                <li><a href="tel:4008108888" class="onactive" ><span class="icons icons_4"></span><label>联系客服</label></a></li>
                
				{else}
                <li><a href="tel:4008108888" ><span class="icons icons_4"></span><label>联系客服</label></a></li>
				{/if}
                                
                {if $_GPC['do']=='wlmylike'}				
                <li><a href="mobile.php?act=channel&name=home&weid=1" class="onactive" ><span class="icons icons_1"></span><label>个人中心</label></a></li>
                
				{else}
                <li><a href="mobile.php?act=channel&name=home&weid=1" ><span class="icons icons_1"></span><label>个人中心</label></a></li>
				{/if}			


                <li>
                
                <a href="javascript:void(0);" id="my_menu"><span class="icons icons_5"></span></a>
                
                
                </li>
            </ul>
 </div>
 <script>
            var footer = document.getElementById("footer_menu");
            var evtObj = {
                handleEvent: function(evt){
                    if("A" == evt.target.tagName){
                        evt.target.classList.toggle("on");
                    }
                }
            }
            footer.addEventListener("touchstart", evtObj, false);
            footer.addEventListener("touchend", evtObj, false);
			
			$("a").click(function(){
			//	MLoading.show('加载中');
			});


 </script>
 

<script type="text/javascript">
    $(function(){
        $(".chefdetail").each(function(){
            var $targetEle = $(this).find("em").first();
            var $btnCtrl = $(this).find("i").last();
            var strAll = $targetEle.html();

            if (strAll.length >50)
            {
                var sonStr = strAll.substr(0,50);
                $targetEle.html(sonStr+"...");

                $btnCtrl.click(function(){

                    if ($btnCtrl.text()=="更多")
                    {
                        $targetEle.html(strAll);
                        $btnCtrl.text("隐藏");
                    }
                    else{
                        $targetEle.html(sonStr+"...");
                        $btnCtrl.text("更多");
                    }
                });
            }
            else{$btnCtrl.html("")}
        });
    });

    var diyprice;
    //show img detail
    function showImgDetail2(thi){
        MLoading.show('加载中');
        var params = {
        }

        var _tmpHtml ='<p><label style="font-size:0.8rem">选择就餐时间：</label>';
        _tmpHtml =_tmpHtml+'<span style="height: 20px;font-size:0.8rem" id="shangyue"><<上 月 </span> &nbsp;&nbsp;<span id="theyear" style="font-size:0.8rem"></span>&nbsp;&nbsp;  <span   style="height: 20px;font-size:0.8rem" id="xiayue">下 月>> </span></p>';
        _tmpHtml =_tmpHtml+'<div id="da"><div class="xingqi"><ul style="width: 325px;">';
        _tmpHtml =_tmpHtml+'<li style="width: 39px;">周日</li>';
        _tmpHtml =_tmpHtml+'<li style="width: 39px;">周一</li>';
        _tmpHtml =_tmpHtml+'<li style="width: 39px;">周二</li>';
        _tmpHtml =_tmpHtml+'<li style="width: 39px;">周三</li>';
        _tmpHtml =_tmpHtml+'<li style="width: 39px;">周四</li>';
        _tmpHtml =_tmpHtml+'<li style="width: 39px;">周五</li>';
        _tmpHtml =_tmpHtml+'<li style="width: 39px;">周六</li></ul></div>';
        _tmpHtml =_tmpHtml+'<div class="cls"></div>';
        _tmpHtml =_tmpHtml+'<div id="da2"></div></div>';
        MDialog.popupCustom(_tmpHtml,true,true);
        
        
        initday(d);
        MLoading.hide();
	//下个月
	$("#shangyue").click(function(){
		hiddenday = new Date(hiddenday.getFullYear(),hiddenday.getMonth()-1,1);
		initday(hiddenday);
	});
	//上个月
	$("#xiayue").click(function(){
		hiddenday = new Date(hiddenday.getFullYear(),hiddenday.getMonth()+1,1);
		initday(hiddenday);
	});
    }

    function xuancai()
    {

        if($('#sdate').val() == 0)
        {
            alert('请选择服务日期');
            return false;
        }
        window.location.href="{php echo  $this->createMobileUrl('wlindex',array('chefid'=>$row['id']))}&sdate="+$('#sdate').val();

    }
    function showcates(catid){
        
        if(catid=="0"){
           $(".address_phone").find("li").removeClass("noshow"); 
            
        }else{
        
        $(".address_phone").find("li").each(function(){ 
            if($(this).hasClass("goods"+catid)){    
                $(this).removeClass("noshow"); 
            }else{
                
                $(this).addClass("noshow"); 
            }
        });   
        }
	  	$(".paiming").animate({left:'0px'},1);
		$(".right_part").fadeOut(1);
        $("#remove").css("right","0px");
    }
    function getgenius(gid,obj){
        if(gid.length=="0"){
            return;
        }
        //currencolor   normailcolor
        $("#tao1").find("li").removeClass("currencolor");
        $("#tao2").find("li").removeClass("currencolor");
        
        obj.addClass("currencolor");
        if(gid=="0"){
            diyprice=0;
            diy=1;
            pakage=0;
            $(".address_phone").find(".numBox").val(0);
            $(".address_phone").find("input").removeAttr("checked");
            $(".address_phone").find("label").removeClass("form_lable_checked"); 
            
            $(".address_phone").find(".numBox").attr("isgen",'0');
            $("#totalprice").html("0");  
            return;          
        }
        $.ajax({
         url:"{php echo  $this->createMobileUrl('wlgetgenius')}",
         data:{'gid':gid},
         type:'POST',
         dataType:'json',
         cache:false,
         beforeSend:function(){
           MLoading.show('加载中');
         },
         success:function(msgObj){
            if(msgObj.errorcode=="200"){
                diy=0;
                pakage=gid;
                $(".address_phone").find("input").removeAttr("checked");
                $(".address_phone").find("label").removeClass("form_lable_checked");
                $(".address_phone").find(".numBox").val(0);
                $(".address_phone").find(".form_radio").attr("isgen",'0');
                
                if(msgObj.list.length>0){
                    
                    for (i=0;i<msgObj.list.length ;i++ ){
                        $("#dishs"+msgObj.list[i]).addClass("form_lable_checked");
                        $("#dishs"+msgObj.list[i]).parents(".address_phonelist").find("input").attr("checked",'true');
                        $("#numBox"+msgObj.list[i]).val(1);
                        $("#teacher"+msgObj.list[i]).attr("isgen",'1');
                    }
                }
                diyprice=msgObj.totalprice;
                $("#totalprice").html(""+msgObj.totalprice);
                
            }else{
                
                alert(msgObj.message);
            }
            
            MLoading.hide();
         }
         });                        
        
        
    }
     function mcheck(obj,divid,price){

        
        var v=$("#numBox"+divid).val();
        var isgen=$("#teacher"+divid).attr("isgen");
        if(diy==0&&isgen=="1"){
            return;
        }        
        var oldval=v;
        if(obj.hasClass("form_lable_checked")){
            obj.removeClass("form_lable_checked");
            obj.parents(".address_phonelist").find("input").removeAttr("checked");
            //diyprice=diyprice-price*v;
            $("#numBox"+divid).val(0);
            
        }else{
            
            if(v==0){
                $("#numBox"+divid).val(1);
            }
            //diyprice=diyprice+price*v;
            obj.addClass("form_lable_checked");
            obj.parents(".address_phonelist").find("input").attr("checked",'true');
        }
        gettotalamount();
        //$("#totalprice").html("￥"+diyprice);
     }
     function gettotalamount(){
        
        var thisprice=0;
        var isgen=0;
        var vid="";
        $(".form_lable").each(function(){  
            if($(this).hasClass("form_lable_checked")){
                vid=$(this).parents(".address_phonelist").find("input").val();
                if($("#numBox"+vid).val()!=undefined){
                    price= parseFloat($("#numBox"+vid).attr("price"));
                    if(diy==0){
                        isgen=$("#teacher"+vid).attr("isgen");
                        if(isgen==0){
                            thisprice=thisprice+price*($("#numBox"+vid).val());
                        }else{
                            thisprice=thisprice+price*($("#numBox"+vid).val()-1);
                        }
    
                    }else{
                        thisprice=thisprice+price*$("#numBox"+vid).val();
                    }
                    
                }                   
            }
        });

         if(diy==0){
            thisprice=parseFloat(diyprice)+thisprice;
         }
        $("#totalprice").html(""+thisprice);
     }
     
     
        function showgoodsDetail(thi){
           
            var params = {
            "goodsid":thi,
            "weid":1
            }            
             _doAjax("{php echo  $this->createMobileUrl('wldetailajax')}", "POST", params, function(res) {
                MLoading.hide();
                    
                   if(res.type=="error"||res.type=="ajax"){
                        alert(res.message);    
                   }else{
                       
                popPic(res.thumb,
                    res.title,
                    res.productprice + '元/'+res.unit,
                    1,
                    res.productprice + '元/'+res.unit,
                    "",
                    res.main,
                    res.content,
                    res.addtion,
                    res.other,
                    res.description
                );
                                        
                   }

                
                            
            
            
            });
        }
        function popPic(imgUrl,title,price, isSpecial, specialPrice, people,teast,assess,fliao,xliao,diyliao){
            var _title = title,
                _price = price,
                _people = null;//people,
                _teast = teast,
                _assess = assess;

                _tmpHtml = "<div class='content' style='height:400px;overflow:auto'><div style='width: 100%;position: relative;'><img src='"+imgUrl+"' alt='' title='' style='width:100%'>";

                //_tmpHtml += "</h2>";
                
                _tmpHtml +='<div class="navcaititle" style="color: #c9a063;height: 30px; font-size: 0.8rem;width:100%;text-align: left;"><span style="float: right;"><em style="font-size: 0.4rem;">￥</em>'+_price+'<em style="font-size: 0.4rem;">/份</em></span> '+_title+'  </div></div>';
                

                 _tmpHtml += '<p><textarea name="remark" style="height:40px;width:100%" maxlength="100" placeholder="如有附加需求或忌口，请备注,我们会尽量安排" class="input_text"></textarea></p>';
                
                if (_assess) {
                    _tmpHtml += "<p>"+_assess+"</p>";
                }                
                

                _tmpHtml += '</div>';
            MDialog.popupCustom(_tmpHtml,true,true);
        }   
    
    function window_onload(){
    

        $.ajax({
         url:"{php echo  $this->createMobileUrl('wlcheckcart')}",
         data:{"shop_id":{$id}},
         type:'POST',
         dataType:'json',
         cache:false,
         beforeSend:function(){
           MLoading.show('加载中');
         },
         success:function(msgObj){
            if(msgObj.errorcode=="200"){
                
                
                
                if(msgObj.pakageid!="0"){
                    diy=0;    
                }else{
                    diy=1;
                }
                pakage=msgObj.pakageid;
                $(".address_phone").find("input").removeAttr("checked");
                $(".address_phone").find("label").removeClass("form_lable_checked");
                $(".address_phone").find(".numBox").val(0);
                $(".address_phone").find(".form_radio").attr("isgen",'0');
                
                if(msgObj.list.length>0){
                    for (i=0;i<msgObj.list.length ;i++ ){
                        $("#dishs"+msgObj.list[i].goodid).addClass("form_lable_checked");
                        $("#dishs"+msgObj.list[i].goodid).parents(".address_phonelist").find("input").attr("checked",'true');
                        $("#numBox"+msgObj.list[i].goodid).val(msgObj.list[i].num);
                        $("#teacher"+msgObj.list[i].goodid).attr("isgen",msgObj.list[i].isgen);    
                        
                    }
                }
                diyprice=msgObj.diyprice;
                $("#totalprice").html(""+msgObj.totalprice);
                
                                
                
            }else{
                
            }
            
            MLoading.hide();
         }
         });
                 

    } 
      
    $(document).ready(function(){
        $('#my_menu').click(function(){
        var i=0;
        var s1="";
        var s2="";
        var s3="";
        
        $(".form_lable").each(function(){     
            if($(this).hasClass("form_lable_checked")){
                //vid=$(this).parents(".address_phonelist").find("input").val();
                if($(this).parents(".address_phonelist").find("input").val()!=undefined){
                    s2=s2+$(this).parents(".address_phonelist").find("input").val()+",";
                    s3=s3+$("#numBox"+$(this).parents(".address_phonelist").find("input").val()).val()+",";
                }                
                i++;    
            }
        });
        if(i==0){
            alert("请选择菜品！");
            return;    
        }
        var sdate=$('#choosedate').val();
        if(sdate==""){
            alert("请选择用餐时间！");
            return;    
            
        }
        $.ajax({
         url:"{php echo  $this->createMobileUrl('wlcheckout')}",
         data:{'diy':diy,"dishes":s2,"dishnum":s3,"pakage":pakage,"sdate":sdate,"shop_id":{$id}},
         type:'POST',
         dataType:'json',
         cache:false,
         beforeSend:function(){
           MLoading.show('加载中');
         },
         success:function(msgObj){
            if(msgObj.errorcode=="200"){
                location.href='mobile.php?act=module&name=shopping3&do=wlcart&weid=1';
            }else{
                alert(msgObj.message);
            }
            
            MLoading.hide();
         }
         });        
            
            
            //location.href='mobile.php?act=module&name=shopping3&do=wlcart&weid=1';

        });


   $("#remove").toggle(
	  function(){
	 	 $(".paiming").animate({left:'-150px'},1);
		 $(".right_part").show();
         $("#remove").css("right","150px");
         
         
		 },
	  function(){
	  	$(".paiming").animate({left:'0px'},1);
		$(".right_part").fadeOut(1);
        $("#remove").css("right","0px");
		}
	);
    
    });


    function changeCount(thi, evt, dishes_id) {
        if ("button" == evt.target.type) {
            var counter = thi.querySelectorAll("input[name='numBox']")[0];
            var val = parseInt(counter.value);

            var isgen=$("#teacher"+dishes_id).attr("isgen");
            var obj=$("#dishs"+dishes_id);
            //var countnums = parseInt($("#countnums").attr("nums"));
            if ("btn-reduce" == evt.target.className) {
                val--;
            } else {
                val++;
            }

			if(diy==0 && val<1 && isgen==1){
			     return;
			}
           
			if(val > 0){
                if ("btn-reduce" == evt.target.className) {
                   // var num = countnums - 1;
                } else {
                    //var num = countnums + 1;
                }
                
				counter.value = Math.max(0, val);
                
                obj.addClass("form_lable_checked");
                obj.parents(".address_phonelist").find("input").attr("checked",'true');
                           
				//document.getElementById("countnums").innerHTML = num;
				//$("#countnums").attr("nums",num);
                //$("#totalnum").val(num);
                /*                        
				$.post("mobile.php?act=module&name=shopping3&do=wlupdatecart&weid=1", {"dishes_id":dishes_id,"total": val},function(data){
					if(data.message.status==1){
						//数据成功
						counter.value = Math.max(0, val);

						document.getElementById("countnums").innerHTML = num;
						$("#countnums").attr("nums",num);
						$("#totalnum").val(num);
						var totalPrice = 0;
						for (var i = 0, ci; ci = window.res.data[i]; i++) {
							if (dishes_id == ci.dishes_id) {
								ci.selected_count = counter.value;
								//break;
							}
							totalPrice += parseFloat(ci.price) * parseInt(ci.selected_count);
						}
						$("#totalprice").val(totalPrice);
						document.getElementById("total").innerHTML = (totalPrice).toFixed(2);
					}else{
						//数据失败
						alert(data.message.message);
						//alert('error');
						
					}
				}, "json");
                */
			}else{
			//	alert('数量已经小于0');
            counter.value =0;
            obj.removeClass("form_lable_checked");
            obj.parents(".address_phonelist").find("input").removeAttr("checked");			
			}
            gettotalamount(); 
          
            //switchMenu();
        }
    }

</script>
</body>
</html>